package game;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Server simulates the behaviour of typical server who always listen for
 * clients' requests.
 * 
 * @author Tsvetan Vasilev
 * 
 */
public class Server implements Runnable {

	private static int PORT = 23;

	@Override
	public void run() {
		ServerSocket serverSocket = null;
		Socket socket = null;
		try {
			serverSocket = new ServerSocket(PORT);
			PlayersManager playersManager = new PlayersManager();
			while (true) {
				socket = serverSocket.accept();
				playersManager.addPlayer(socket);
			}

		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
